package top.chukongxiang.project.base.exception;

import lombok.Getter;
import top.chukongxiang.project.base.model.response.RCode;

/**
 * 执行失败异常处理
 */
@Getter
public class DoFailedException extends RuntimeException {

    private final Integer code;
    private final String message;

    public DoFailedException(String message) {
        super(message);
        this.message = message;
        this.code = -1;
    }

    public DoFailedException(int code, String message) {
        this.message = message;
        this.code = code;
    }

    public DoFailedException(RCode responseCode) {
        this.message = responseCode.getMsg();
        this.code = responseCode.getCode();
    }
}
